<template>
  <div class="brand">
    <div class="goods-top">
      <div class="top-back" @click="backhome">
        <img src="@/assets/back.png" alt="" />
        <p>返回</p>
      </div>
      <p>品牌制造商</p>
    </div>
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
      class="content"
    >
      <div class="brand-item" v-for="item in listInfo" :key="item.id" @click="godetail(item.id)">
        <img :src="item.app_list_pic_url" alt="" />
        <div class="item-title">
            <p>{{ item.name }}</p>
            <span>|</span>
            <p>{{ item.floor_price }}元起</p>
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>
import { listaction} from "@/api/home/brand/index";
export default {
  name: "Index",

  data() {
    return {
      listInfo: [],
      loading: false,
      finished: false,
      start: 1,
    };
  },
  created() {},

  mounted() {},

  methods: {
    backhome() {
      this.$router.go(-1);
    },

    onLoad() {
      listaction({
        page: this.start
      })
      .then((res) => {
        console.log(res);
        this.listInfo.push(...res.data);
        this.loading = false;
        this.start++;
        if (this.start == res.total) {
          this.finished = true;
        }
      })
    },

    godetail(val){
        this.$router.push({
            name:'brandDetail',
            query:{
               id:val 
            }
        })
    }
  },
};
</script>

<style scoped lang="scss">
@import "../scss/brand/index.scss";
* {
  margin: 0;
  padding: 0;
}
</style>